package com.dkd.flow.emums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Arrays;
//节点类型
public enum NodeType implements IEnum<String> {
    //start:发起，condition：条件，copy：抄送，approver：审批
    START("start", "发起"), CONDITION("condition", "条件"), CC("copy", "抄送"), APPROVER("approver", "审批");
    @EnumValue
    private final String value;
    private final String name;
    NodeType(String value, String name) {
        this.value = value;
        this.name = name;
    }
    @Override
    @JsonValue
    public String getValue() {
        return value;
    }
    public String getName() {
        return name;
    }
    public static NodeType getNodeTypeByValue(String value) {
        return Arrays.stream(NodeType.values())
                .filter(fv -> fv.value.equals(value))
                .findFirst()
                .orElse(null);
    }
}
